package ihistoryApp.dal.controller;

import ihistoryApp.dal.entity.Title;
import ihistoryApp.request.ConferTitleRequest;
import ihistoryApp.request.GetTitleListRequest;
import ihistoryApp.request.SetShowTitleRequest;
import ihistoryApp.service.AchievementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/achievement")
public class AchievementController {
    @Autowired
    private AchievementService achievementService;

    @PostMapping("/confer")
    public ResponseEntity<String> confer(@RequestBody ConferTitleRequest request) {
        return ResponseEntity.ok(achievementService.confer(request));
    }

    @PostMapping("/getTitleList")
    public ResponseEntity<List<Title>> getTitleList(@RequestBody GetTitleListRequest request) {
        return ResponseEntity.ok(achievementService.getTitleList(request));
    }

    @PostMapping("/setShowTitle")
    public ResponseEntity<String> setShowTitle(@RequestBody SetShowTitleRequest request) {
        return ResponseEntity.ok(achievementService.setShowTitle(request));
    }
}
